<script setup lang="ts">
import { ref, onMounted, } from 'vue';
import { getSituationApi } from '../../api/index';
import LeftTitle from '../../components/LeftTitle.vue';

// 定义类型
interface typeData {
    [key: string]: any
}

const getSituationData: typeData = ref([]);
onMounted(async () => {
    const res = await getSituationApi();
    // console.log(res.data.data.result[0], 11111);
    getSituationData.value = res.data.data.result[0];
});
</script>

<template>
    <div class="container">
        <LeftTitle title="监控情况"></LeftTitle>
        <div class="lou-box">
            <div class="lou-item" v-for="(item, index) in getSituationData" :key="index">
                <img :src="item.img" alt="">
                <div class="item-right">
                    <div>
                        <p>{{ item.floor }}</p>
                        <p>正常数量: <span class="gren">{{ item.normalNum }}</span></p>
                    </div>
                    <div>
                        <p>设备数量: <span class="gren">{{ item.handclapNum }}</span></p>
                        <p>故障数量: <span class="oran">{{ item.equipmentNum }}</span></p>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<style scoped lang="scss">
.container {
    width: 100%;
    height: 38%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;

    .lou-box {
        flex: 1;
        margin-top: 2%;
        // width: 100%;
        // height: 83%;
        background-color: #092C75;
        color: #D1D8E6;
        font-size: 13px;
        overflow: hidden; // 5555555555555

        .lou-item {
            width: 100%;
            height: 35%;
            margin-bottom: 10px;
            display: flex;
            align-items: center;
            justify-content: space-around;

            >img {
                width: 90px;
                height: 60px;
                margin: 0 10px;
            }

            .item-right {
                width: 60%;
                height: 100%;
                display: flex;
                align-items: center;
                justify-content: space-around;

                .gren {
                    color: #52A1AC;
                    font-weight: bold;
                }

                .oran {
                    color: #8A6249;
                    font-weight: bold;
                }
            }
        }
    }
}
</style>